草庐IT

javascript - 回溯 Firefox 历史,JavaScript 无法运行

全部标签

ruby - 我如何从 Capistrano 运行 rake 任务?

我已经有一个deploy.rb可以在我的生产服务器上部署我的应用程序。我的应用程序包含一个自定义rake任务(lib/tasks目录中的一个.rake文件)。我想创建一个cap任务来远程运行该rake任务。 最佳答案 更明确一点,在您的\config\deploy.rb中,在任何任务或命名空间之外添加:namespace:rakedodesc"Runataskonaremoteserver."#runlike:capstagingrake:invoketask=a_certain_tasktask:invokedorun("cd#{

ruby-on-rails - 如何在测试环境运行Rails控制台并加载test_helper.rb?

背景:我在使用Thoughtbot的“工厂女孩”gem时遇到了一些问题,该gem用于创建要在单元测试和其他测试中使用的对象。我想转到控制台并运行不同的FactoryGirl调用以检查发生了什么。例如,我想去那里做...>>Factory(:user).inspect我知道您可以在不同的环境中运行控制台...$脚本/控制台RAILS_ENV=test但是当我这样做时,工厂类不可用。看起来好像test_helper.rb没有加载。我尝试了各种require调用,包括一个带有到test_helper.rb的绝对路径的调用,但它们的失败与此类似:$script/consoleRAILS_ENV

ruby-on-rails - 如何让 Ruby/Homebrew/RVM 在 Yosemite 上运行?

安装Yosemite后,我无法运行brew或ruby​​。我在brewupdate上遇到这个错误:/usr/local/bin/brew:/usr/local/Library/brew.rb:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby:badinterpreter:Nosuchfileordirectory/usr/local/bin/brew:line23:/usr/local/Library/brew.rb:Undefinederror:0在irb上得到这个错误:/System/Librar

ruby-on-rails - 如何避免运行 ActiveRecord 回调?

我有一些模型具有after_save回调。通常这很好,但在某些情况下,例如创建开发数据时,我想在不运行回调的情况下保存模型。有没有一种简单的方法可以做到这一点?类似于...Person#save(:run_callbacks=>false)或Person#save_without_callbacks我查看了Rails文档,但没有找到任何内容。然而,根据我的经验,Rails文档并不总能说明全部情况。更新我找到了ablogpost这解释了如何从这样的模型中删除回调:Foo.after_save.clear我找不到记录该方法的位置,但它似乎有效。 最佳答案

ruby - 如何在 Rspec 中只运行特定的测试?

我认为有一种方法可以只运行具有给定标签的测试。有人知道吗? 最佳答案 您可以使用:focus散列属性标记示例。例如,#spec/foo_spec.rbRSpec.describeFoodoit'isneverexecuted'doraise"neverreached"endit'runsthisspec',focus:truedoexpect(1).toeq(1)endendrspec--tagfocusspec/foo_spec.rb有关GitHub的更多信息.(谁有更好的链接,请指教)(更新)RSpec现在是superblydo

ruby - 无法安装 RMagick 2.13.1。无法找到 MagickWand.h。

当我尝试安装rmagick时,我收到以下错误消息:Can'tinstallRMagick2.13.1.Can'tfindMagickWand.h.***extconf.rbfailed***CouldnotcreateMakefileduetosomereason,probablylackofnecessarylibrariesand/orheaders.Checkthemkmf.logfileformoredetails.Youmayneedconfigurationoptions.我在MacOSX10.6.8、ruby1.9.2p290、rvm1.10.2上。谁能帮我解决这个问题。

ruby-on-rails - 无法安装 gem - 无法构建 gem native 扩展 - 无法加载此类文件 -- mkmf (LoadError)

ruby1.9.3Gemfile部分#...............gem"pony"gem"bcrypt-ruby",:require=>"bcrypt"gem"nokogiri"#..................当我尝试安装gems时,出现错误alex@ubuntu:~/$bundleFetchinggemmetadatafromhttp://rubygems.org/.........Fetchinggemmetadatafromhttp://rubygems.org/..EnteryourpasswordtoinstallthebundledRubyGemstoyoursy

ruby - 无法在 OS X "El Capitan"上安装 gems

我无法在ElCapitanBeta5上安装和运行fakes3gem。我试过:sudogeminstallfakes3ERROR:Whileexecutinggem...(Errno::EPERM)Operationnotpermitted-/usr/bin/fakes3然后我尝试用cocoapods的方式来做。它适用于cocoapods但不适用于fakes3。mkdir-p$HOME/Software/rubyexportGEM_HOME=$HOME/Software/rubygeminstallcocoapods[...]1geminstalledgeminstallfakes3ER

ruby-on-rails - 无法安装 pg gem

我尝试使用geminstallpg但它似乎不起作用。geminstallpg给出这个错误TemporarilyenhancingPATHtoincludeDevKit...Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingpg:ERROR:Failedtobuildgemnativeextension.C:/Ruby/bin/ruby.exeextconf.rbcheckingforpg_config...noNopg_config...tryinganyway.Ifbuildingfails,ple

ruby-on-rails - PG::ConnectionBad - 无法连接到服务器:连接被拒绝

每次我运行rails4.0服务器时,我都会得到这个输出。StartedGET"/"for127.0.0.1at2013-11-0623:56:36-0500PG::ConnectionBad-couldnotconnecttoserver:ConnectionrefusedIstheserverrunningonhost"localhost"(::1)andacceptingTCP/IPconnectionsonport5432?couldnotconnecttoserver:ConnectionrefusedIstheserverrunningonhost"localhost"(12